#ifndef __DBCLASS_H__
#define __DBCLASS_H__

//#include "common.cpp"

#include <mysql++.h>
#include <ssqls.h>
#include <query.h>
#include <string>

#include <iostream>

//a simple wrapper for mysqlpp class
//automatically connects to the database, parse and
//undertake queries
class dbclass : public mysqlpp::Connection
{
public:

	dbclass();
	~dbclass();

	int insert_table_phase1(std::string table_name, char* id, int _pos, int _num);
	int insert_table_phase2(std::string table_name, char _id, int pos);

	//bool show_coin(std::string cipher_txt, int _num, int thres);

	//double com_sta(std::string cipher_txt, double k_p, double k_r);

	void disconnect_db();
	bool connect_db(std::string db_name);

	bool create_table_phase1(std::string table_name);

	bool create_table_phase2(std::string table_name);

	void drop_table(std::string table_name);


private:

	//int num;

	//connection object
	//mysqlpp::Connection conn;


	//result column of the table
	//mysqlpp::UseQueryResult res;


	//buffer
	char buffer[241];
};



#endif
